<template>
	<view class="page">
		
		<view class="page-top flex flex-a-end flex-a-center">
			<view class="flex flex-a-center">
				<navigator open-type="navigateBack" class="back"><arrow size="50" color="#ffffff" direction="left"></arrow></navigator>
				<image class="page-top-head" mode="aspectFit" src="../../../static/icons/agent_jewel/agent_i2.png"></image>
				<text class="page-top-text"></text>
			</view>
		</view>
		<view class="page-cont">
			<view class="page-cont-top flex flex-a-center flex-j-center">
				<view class="page-cont-top-item">
					<view class="page-cont-top-item-num">18.9 %</view>
					<view class="page-cont-top-item-text">体脂率</view>
				</view>
				<view class="page-cont-top-circular">
					<canvas canvas-id="firstCanvas" id="firstCanvas" class="page-cont-top-circular-canvas"></canvas>
				</view>
				<view class="page-cont-top-item">
					<view class="page-cont-top-item-num">75</view>
					<view class="page-cont-top-item-text">身体状态指数</view>
				</view>
			</view>
			<!-- <navigator url="/pages/jewel/health/check" class="page-cont-testBtn">测量</navigator> -->
			<navigator url="/pages/jewel/user/checkup_report" class="page-cont-testBtn">体检报告</navigator>
			<view class="page-cont-list flex">
				<view class="page-cont-list-item">
					<view class="page-cont-list-item-num">44.2kg</view>
					<view class="page-cont-list-item-text">水分</view>
				</view>
				<view class="page-cont-list-item">
					<view class="page-cont-list-item-num">正常</view>
					<view class="page-cont-list-item-text">肥胖等级</view>
				</view>
				<view class="page-cont-list-item">
					<view class="page-cont-list-item-num">11.2kg</view>
					<view class="page-cont-list-item-text">蛋白质</view>
				</view>
				<view class="page-cont-list-item">
					<view class="page-cont-list-item-num">20.1</view>
					<view class="page-cont-list-item-text">BMI</view>
				</view>
				<view class="page-cont-list-item">
					<view class="page-cont-list-item-num">52.5kg</view>
					<view class="page-cont-list-item-text">肌肉量</view>
				</view>
				<view class="page-cont-list-item">
					<view class="page-cont-list-item-num">6</view>
					<view class="page-cont-list-item-text">内脏脂肪指数</view>
				</view>
			</view>
		</view>
		<view class="page-cont-advise flex flex-a-center flex-j-center">
			<navigator open-type="navigate" url="/pages/jewel/health/today" class="page-cont-advise-item flex flex-a-center flex-j-center">
				<image class="page-cont-advise-item-icon" src="../../../static/images/jewel/health/icon2.png"></image>健康体检
			</navigator>
			<navigator open-type="navigate" url="/pages/jewel/health/recordBlood" class="page-cont-advise-item flex flex-a-center flex-j-center">
				<image class="page-cont-advise-item-icon" src="../../../static/images/jewel/health/icon1.png"></image>血压测算
			</navigator>
		</view>
	</view>
</template>

<script>
	import jewel from '@/common/common_zb.js';
	export default {
		data() {
			return {
				cateList: []
			};
		},
        methods: {
			draw(){
				var ctx = uni.createCanvasContext('firstCanvas')
				// 左边弧线
				var start1 = (Math.PI/180) * 130
				var end1 = (Math.PI/180) * 215
				var grd=ctx.createLinearGradient(0,0,0,170);
				grd.addColorStop(0,"#fe8871");
				grd.addColorStop(1,"#ffbf63");
				ctx.beginPath();
				ctx.arc(75, 75, 67, start1, end1, false);
				ctx.setStrokeStyle(grd)
				ctx.setLineCap('round');
				ctx.setLineWidth(10);
				ctx.stroke()
				// 中间弧线
				var start2 = (Math.PI/180) * 227
				var end2 = (Math.PI/180) * 312
				var grd2=ctx.createLinearGradient(0,0,0,170);
				grd2.addColorStop(0,"#60b764");
				grd2.addColorStop(1,"#82e186");
				ctx.beginPath();
				ctx.arc(75, 75, 67, start2, end2, false);
				ctx.setStrokeStyle(grd2)
				ctx.setLineCap('round');
				ctx.setLineWidth(10);
				ctx.stroke()
				// 右边弧线
				var start3 = (Math.PI/180) * 325
				var end3 = (Math.PI/180) * 410
				var grd3=ctx.createLinearGradient(0,0,170,0);
				grd3.addColorStop(0,"#ee96fb");
				grd3.addColorStop(1,"#d171fe");
				ctx.beginPath();
				ctx.arc(75, 75, 67, start3, end3, false);
				ctx.setStrokeStyle(grd3)
				ctx.setLineCap('round');
				ctx.setLineWidth(10);
				ctx.stroke()
				
				
				ctx.draw()
			}
        },
        onLoad() {
			
        },
		onReady() {
			this.draw()
		}
	}
</script>

<style lang="scss" scoped>
	
	.page{
		background-color: #f7f7f7 !important;
	}
	.flex{
		display: flex;
		&1{
			flex: 1;
		}
		&-a-center{
			align-items: center;
		}
		&-a-start{
			align-items: flex-start;
		}
		&-a-end{
			align-items: flex-end;
		}
		&-j-center{
			justify-content: center;
		}
		&-j-start{
			justify-content: flex-start;
		}
		&-j-end{
			justify-content: flex-end;
		}
	}
	
	.page{
		&-top{
			background-image: url(../../../static/images/jewel/health/top_bg.jpg);
			background-color: #0e820c;
			background-repeat: no-repeat;
			background-position: top center;
			background-size: contain;
			height: 275rpx;
			padding: 40rpx{
				bottom: 120rpx;
			};
			box-sizing: border-box;
			&-head{
				height: 70rpx;
				width: 70rpx;
				display: block;
				margin-right: 20rpx;
			}
			&-text{
				color: #FFFFFF;
				font-size: 36rpx;
				line-height: 70rpx;
			}
		}
		.page-cont{
			width: 710rpx;
			margin: 0 auto;
			background-color: #FFFFFF;
			margin-top: -90rpx;
			border-radius: 10rpx;
			padding-top: 82rpx;
			padding-bottom: 35rpx;
			&-top{
				&-item{
					text-align: center;
					width: 200rpx;
					&-num{
						font-weight: bold;
						font-size: 44rpx;
					}
					&-text{
						color:#4c4c4c;
						font-size: 28rpx;
					}
				}
				&-circular{
					width: 300rpx;
					height: 300rpx;
					&-canvas{
						width: 300rpx;
						height: 300rpx;
					}
				}
			}
			&-testBtn{
				color: #FFFFFF;
				width: 300rpx;
				line-height: 88rpx;
				text-align: center;
				font-size: 34rpx;
				border-radius: 50px;
				margin: 0 auto;
				background-color: #0d8b13;
				margin-top: 40rpx;
				margin-bottom: 60rpx;
			}
			&-list{
				margin: 0 20rpx;
				flex-wrap: wrap;
				position: relative;
				&-item{
					width: 222rpx;
					text-align: center;
					margin: 40rpx 0;
					&-num{
						font-size: 36rpx;
						font-weight: bold;
						margin-bottom: 12rpx;
					}
					&-text{
						font-size: 30rpx;
						color: #4c4c4c;
					}
				}
				&::after{
					content: '';
					position: absolute;
					width: 100%;
					height: 2rpx;
					background-color: #f2f2f2;
					top: 50%;
				}
			}
			&-advise{
				&-item{
					width: 346rpx;
					height: 106rpx;
					background-color: #FFFFFF;
					font-size: 32rpx;
					margin: 25rpx 10rpx;
					border-radius: 10rpx;
					&-icon{
						width: 60rpx;
						height: 60rpx;
						display: block;
						margin-right: 10rpx;
						border-radius: 50px;
					}
				}
			}
		}
	}
</style>
